
class posnet_underlay_memory(object):
	def __init__(self):
		object.__init__(self)
		self.node_handles = dict()
	def add(self,node_id,node_handle):
		self.node_handles[node_id] = node_handle
	def remove(self,node_id):
		del self.node_handles[node_id]
	def clear(self):
		self.node_handles.clear()
	def set(self,node_handles):
		self.node_handles = node_handles
	def _send_to_node(self,node_handle,data):
		meth = getattr(node_handle,"receive")
		meth(data)
	def propagate_message(self,message):
		target_node_id = message.target
		target_handle = self.node_handles[target_node_id]
		self._send_to_node(target_handle,message)
		
